<style>
    .menuContent {
        z-index: 99999;
    }
    ul.ztree {
        margin-top: 1px;
        border: 1px solid #dddddd;
        height: 300px;
        background: #fefefe;
        overflow-y: scroll;
        overflow-x: auto;
    }
</style>
<form class="form-horizontal" id="winModal">
    <input id="id" name="id" type="hidden">
    <div class="form-group">
        <label class="col-sm-3 control-label text-left">用户昵称：</label>
        <div class="col-sm-8">
            <input id="nickName" name="nickName" class="form-control" type="text" placeholder="请输入用户昵称">
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label text-left">登陆账号：</label>
        <div class="col-sm-8">
            <input id="userName" name="userName" class="form-control" type="text" placeholder="请输入登陆账号">
        </div>
    </div>
    <div class="form-group myPassword" style="display: none">
        <label class="col-sm-3 control-label text-left">账号密码：</label>
        <div class="col-sm-8">
            <input id="password" name="password" class="form-control" type="password" placeholder="请输入账号密码" disabled="disabled" readonly="readonly">
        </div>
    </div>
    <div class="form-group myPassword" style="display: none">
        <label class="col-sm-3 control-label text-left">确认密码：</label>
        <div class="col-sm-8">
            <input id="confirm_password" name="confirm_password" class="form-control" type="password" placeholder="请再次输入密码确认" disabled="disabled" readonly="readonly">
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-3 control-label text-left">UKEY：</label>
        <div class="col-sm-8">
            <input id="ukey" name="ukey" class="form-control" type="text" placeholder="请输入UKEY的编号">
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-3 control-label text-left">账号排序：</label>
        <div class="col-sm-8">
            <input id="sort" name="sort" class="form-control" type="number" value="0" min="0" placeholder="请输入排序编号">
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-3 control-label text-left">角色权限：</label>
        <div class="col-sm-8">
            <select class="form-control roleId " id="roleId" name="roleId"></select>
        </div>
    </div>


    <div class="form-group">
        <label class="col-sm-3 control-label text-left">所属部门：</label>
        <div class="col-sm-8">
            <input id="orgId" name="orgId" type="hidden">
            <input id="orgSelect" class="form-control" type="text" placeholder="请选择所属部门" readonly/>
            <div id="menuContent" class="menuContent" style="display:none; position: absolute;z-index: 9999;">
                <ul id="orgTree" class="ztree"></ul>
            </div>
        </div>
    </div>


</form>
<script type="text/javascript">
    $(function () {
        var e = "<i class='fa fa-times-circle'></i>";
        $("#winModal").validate({
            rules: {           //定义验证规则,其中属性名为表单的name属性
                nickName: {
                    required: true,
                    // ignore: ".ignore",//忽略不验证
                    rangelength: [2,20],
                    stringAllName: true,
                    remote: {
                        url: "check.json",
                        type: "post",
                        data: {
                            nickName: function () {
                                return $("#nickName").val();
                            },
                            id: function () {
                                return $("#id").val();
                            }
                        }
                    }
                },
                userName: {
                    required: true,
                    //  ignore: ".ignore",//忽略不验证
                    rangelength: [2, 20],
                    stringEnName: true,
                    remote: {
                        url: "check.json",
                        type: "post",
                        data: {
                            userName: function () {
                                return $("#userName").val();
                            },
                            id: function () {
                                return $("#id").val();
                            }
                        }
                    }
                },
                password: {
                    required: true,
                    minlength: 4,
                    stringPassWord: true,
                },
                confirm_password: {
                    required: true,
                    equalTo: "#password"
                },
                roleId: {
                    required: true,
                    digits: true,
                    minlength: 1
                },
                sort: {
                    required: true,
                    digits: true
                }
            },
            messages: {       //自定义验证消息
                nickName: {
                    required: e + "请输入账号",
                    stringNickName: e + "只能包括中文、英文、数字和下划线，数字和下划线不能开头",
                    rangelength: $.validator.format(e + "账号位数要在{0}-{1}个字符之间。"),
                    remote: $.validator.format(e + "用户昵称“{0}”已经被占用。")
                },
                userName: {
                    required: e + "请输入登陆账号",
                    stringUserName: e + "只能包括英文、数字和下划线，下划线不能开头",
                    rangelength: $.validator.format(e + "登陆账号位数要在{0}-{1}个字符之间。"),
                    remote: $.validator.format(e + "登陆账号“{0}”已经被占用。")
                },
                password: {
                    required: e + "请再次输入密码",
                    stringPassWord: e + "只能包括英文、数字和下划线，下划线不能开头",
                    rangelength: $.validator.format(e + "密码位数最低为{0}个字符。")
                },
                confirm_password: {
                    required: e + "请输入确认密码",
                    equalTo: e + "密码验证需要与密码一致"
                },
                roleId: {
                    required: e + "请选择用户角色"
                },
                sort: {
                    required: e + "排序编号不正确，只允许为正整数"
                }
            }
        });
    });
</script>